import os
import shutil
import json
from Utils import *
file_path = os.path.abspath(__file__)
dir_path = os.path.dirname(file_path).replace("\\file","")
srcAssets = dir_path +'\\mipmap-xhdpi'
desAssets = dir_path.replace("tools","")+'build\\web-mobile'


#移动健康logo
logo = srcAssets+'\\health_hint.png'
shutil.copy(logo, desAssets)


#修改css文件
for file in get_files_css_list(desAssets):
    if file.find("style-desktop")>0 :
        styleDesktopPath = file
    if file.find("style-mobile")>0 :
        styleMobilePath = file


with open(dir_path+'\\file\\style-desktop.css', "r", encoding="utf-8") as file:
    tex_read = file.read()
with open(styleDesktopPath, "w", encoding="utf-8") as file:
    file.write(tex_read)

with open(dir_path+'\\file\\style-mobile.css', "r", encoding="utf-8") as file:
    tex_read = file.read()
with open(styleMobilePath, "w", encoding="utf-8") as file:
    file.write(tex_read)


shutil.rmtree(dir_path+'\\file\\__pycache__')
print('\n完成任务\n')
